class FormSubmissionsController < ApplicationController
  # GET /form_submissions
  # GET /form_submissions.xml
  def index
    @form_submissions = FormSubmission.find(:all)

    respond_to do |format|
      format.html # index.html.erb
      format.xml  { render :xml => @form_submissions }
    end
  end

  # GET /form_submissions/1
  # GET /form_submissions/1.xml
  def show
    @form_submission = FormSubmission.find(params[:id])

    respond_to do |format|
      format.html # show.html.erb
      format.xml  { render :xml => @form_submission }
    end
  end

  # GET /form_submissions/new
  # GET /form_submissions/new.xml
  def new
    @form_submission = FormSubmission.new

    respond_to do |format|
      format.html # new.html.erb
      format.xml  { render :xml => @form_submission }
    end
  end

  # GET /form_submissions/1/edit
  def edit
    @form_submission = FormSubmission.find(params[:id])
  end

  # POST /form_submissions
  # POST /form_submissions.xml
  def create
    @form_submission = FormSubmission.new(params[:form_submission])

    respond_to do |format|
      if @form_submission.save
        flash[:notice] = 'FormSubmission was successfully created.'
        format.html { redirect_to(@form_submission) }
        format.xml  { render :xml => @form_submission, :status => :created, :location => @form_submission }
      else
        format.html { render :action => "new" }
        format.xml  { render :xml => @form_submission.errors, :status => :unprocessable_entity }
      end
    end
  end

  # PUT /form_submissions/1
  # PUT /form_submissions/1.xml
  def update
    @form_submission = FormSubmission.find(params[:id])

    respond_to do |format|
      if @form_submission.update_attributes(params[:form_submission])
        flash[:notice] = 'FormSubmission was successfully updated.'
        format.html { redirect_to(@form_submission) }
        format.xml  { head :ok }
      else
        format.html { render :action => "edit" }
        format.xml  { render :xml => @form_submission.errors, :status => :unprocessable_entity }
      end
    end
  end

  # DELETE /form_submissions/1
  # DELETE /form_submissions/1.xml
  def destroy
    @form_submission = FormSubmission.find(params[:id])
    @form_submission.destroy

    respond_to do |format|
      format.html { redirect_to(form_submissions_url) }
      format.xml  { head :ok }
    end
  end
end
